package day03;
//运算符的演示
public class OperDemo {
    public static void main(String[] args) {
          /*2.1）单独使用时，在前在后都一样
            2.2)被使用时，在前在后不一样
                a++的值为a
                ++a的值为a+1
           */
        /*
        int a = 5,b = 5;
        int c = a++;//将a++的值5赋值给c,同时a自增1
                    //简便记法:a++的值为5,所以c就为5
        int d = ++b;//将++b的值6赋值给d,同时b自增1
                    //简便记法:++b的值为6,所以d就为6
        System.out.println(a);//6
        System.out.println(b);//6
        System.out.println(c);//5
        System.out.println(d);//6
         */
        /*
        int a = 5,b= 10, c=5;
        System.out.println(b>=a||b<c);
        System.out.println(b<=c||b>a);
        System.out.println(b!=c||b>a);
        System.out.println(a==b||b<a);
        int score = 90;
       System.out.println(score<0||score>100);// 成绩不合法验证

        boolean b2 = !(a<b);//因为!为最高优先级,必须后面加括号
        System.out.println(b2);
        System.out.println(!(a<b));
         */
        /*
        //小面试题:
        short s = 5;
//      s = s+10; //编译错误,需强转,改为s = (short)(s+10);
        s += 10;//相当于s = (short)(s+10);"+=...等"自带强转

        int a =5;
        a +=10;//相当于a=(int)(a+10)
        System.out.println(a);          // 15
        a *=2;//相当于a=(int)(a*2)
        System.out.println(a);          //30
        a /=6;//相当于a=(int)(a/6)
        System.out.println(a);          //5
         */
        /*
        5.字符串连接运算符:
            1) +:
                1.1)若两边为数字,则做加法运算
                1.2)若两边出现了字符串,则做字符串连接
                1.3)任何类型的数据于字符串相连,结果都是字符串类型
        int age = 18;
        System.out.println("age=");// age=
        System.out.println(age);   // 18
        System.out.println("age="+age);//age = 18
        System.out.println("我今年"+age+"岁了");//我今年18岁了

        String name = "Hl";
        System.out.println("大家好,我叫"+name);//大家好,我叫HL
        System.out.println("大家好,我叫"+name+",今年"+age+"岁了");
        //大家好,我叫HL,今年18岁了

        System.out.println(10+20+"");
        System.out.println(20+10+""+10+10);
        System.out.println(""+10+20);
        //""做标记,不输出

         */
        int num = 0;
        int flag = num > 0? 1:-1;
        System.out.println(flag);

        //找出两个数中的最大值
        int a = 200, b = 100,c = 400;
        int max = a>b?(a>c?a:c):(b>c?b:c);
        System.out.println(max);

    }
}
